#include <iostream>
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>


void *newthreadrun(void *args)
{
    while (true)
    {
        std::cout << "I new main thread, pid:" << getpid() << std::endl;
        sleep(1);
    }
}
int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, newthreadrun, nullptr); // 创建线程函数（线程id，线程属性，执行方法，参数）

    while (true)
    {
        std::cout << "I am main thread, pid:" << getpid()<< std::endl;
        sleep(1);
    }
    return 0;
}
